﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LosConn.Web.User
{
    public partial class UserUpdate : BasePage.AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindRole();
                Int32 User_ID = Convert.ToInt32(Request.QueryString["id"]);
                Model.Los_User model = new BLL.Los_User().GetModel(User_ID);
                User_Name.InnerHtml = model.User_Name;
                //User_Address.Value = model.User_Address;
                //User_Role_RoleID.Value = model.User_Role_RoleID.ToString();
                //User_PayName.Value = model.User_PayName;
                //User_PayPhone.Value = model.User_PayPhone;
                //User_LogisticsName.Value = model.User_LogisticsName;
                //User_LogisticsPhone.Value = model.User_LogisticsPhone;
                User_Phone.Value = model.User_Phone;
                User_RealName.Value = model.User_RealName;
                //User_RetailID.Value = model.User_RetailID.ToString();
                User_Retail.InnerHtml = new BLL.Los_Retail().GetList(" Retail_ID= " + model.User_RetailID).Tables[0].Rows[0]["Retail_Name"].ToString();
                User_Role_RoleID.Value = model.User_Role_RoleID.ToString();
                User_UserType.InnerHtml = model.User_UserType.Equals(1) ? "总部" : "门市";
                User_UserType_ID.InnerHtml = model.User_UserType.ToString();
            }
        }

        private void BindRole()
        {
            User_Role_RoleID.DataSource = new BLL.Los_User().GetRoleList("");
            User_Role_RoleID.DataTextField = "Role_Name";
            User_Role_RoleID.DataValueField = "Role_ID";
            User_Role_RoleID.DataBind();

            //User_RetailID.DataSource = new BLL.Los_Retail().GetList("");
            //User_RetailID.DataTextField = "Retail_Name";
            //User_RetailID.DataValueField = "Retail_ID";
            //User_RetailID.DataBind();
        }
    }
}